services:
  aiml:
    build:
      args:
        skill_endpoint: aiml
        skillconfig: skills/aiml/aiml_skill.json
        skillhost: 0.0.0.0
        skillport: 2080
      context: ./
      dockerfile: dp/dockerfile_skill_cpu
    environment:
      - CUDA_VISIBLE_DEVICES=""
    ports:
      - 2080:2080
  transfertransfo:
    build:
      context: ./skills/transfertransfo/
    environment:
      DEVICE: cuda
    command: gunicorn --workers=1 server:app -b 0.0.0.0:8007 -t 60
    volumes: []
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints:
          - node.labels.with_gpu == true
  retrieval_chitchat:
    build:
      context: ./skills/retrieval_chitchat/
    command: uvicorn server:app --host 0.0.0.0 --port 8015
    volumes: []
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints:
          - node.labels.with_gpu != true
  convert_reddit_with_personality:
    build:
      context: ./skills/convert_reddit_with_personality/
    command: gunicorn --workers=1 server:app -b 0.0.0.0:8048 -t 60
    volumes: []
    deploy:
      mode: replicated
      replicas: 2
      placement:
        constraints:
          - node.labels.with_gpu != true
  news_skill:
    build:
      context: .
      dockerfile: ./skills/alexa-prize-news/Dockerfile
    command: bash -c "python updater.py | gunicorn --workers=1 server:app -b 0.0.0.0:8027 -t 300"
    volumes: []
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints:
          - node.labels.with_gpu != true
  topicalchat_convert_retrieval:
    build:
      context: ./skills/topicalchat_convert_retrieval/
    command: gunicorn --workers=1 server:app -b 0.0.0.0:8060 -t 60
    volumes: []
    deploy:
      mode: replicated
      replicas: 2
      placement:
        constraints:
          - node.labels.with_gpu != true
          - node.labels.group == 0
  reddit_ner_skill:
    build:
      context: .
      dockerfile: ./skills/reddit_ner_skill/Dockerfile
    command: gunicorn --workers=2 server:app -b 0.0.0.0:8035
    deploy:
      mode: replicated
      replicas: 2
      placement:
        constraints:
          - node.labels.with_gpu != true
  question-generator:
    build:
      context: ./services/question_generator/
      args:
        MODEL_URL: http://lnsigo.mipt.ru/export/alexaprize_data/question_generator/model_24_0.94_37.23.pth
    command: gunicorn --workers=1 --timeout 300 server:app -b 0.0.0.0:8079
    environment:
      - CUDA_VISIBLE_DEVICES=0
      - DECODING=greedy
    deploy:
      mode: replicated
      replicas: 1
      resources:
        limits:
          memory: 3G
        reservations:
          memory: 3G

  speech-function-classifier:
    build:
      args:
        SERVICE_PORT: 8108
        SERVICE_NAME: speech_function_classifier # has to be the same with skill dir name
      context: ./annotators/speech_function_classifier/
    command: uvicorn server:app --reload --host 0.0.0.0 --port 8108
    deploy:
      mode: replicated
      replicas: 2
      resources:
        limits:
          memory: 768M
        reservations:
          memory: 768M

  speech-function-predictor:
    build:
      args:
        SERVICE_PORT: 8107
        SERVICE_NAME: speech_function_predictor # has to be the same with skill dir name
      context: ./annotators/speech_function_predictor/
    command: uvicorn server:app --reload --host 0.0.0.0 --port 8107
    deploy:
      mode: replicated
      replicas: 2
      resources:
        limits:
          memory: 768M
        reservations:
          memory: 768M

  wikidata-dial-skill:
    build:
      args:
         SERVICE_PORT: 8091
      context: skills/wikidata_dial_skill
    command: flask run -h 0.0.0.0 -p 8091
    environment:
      - FLASK_APP=server
    deploy:
      mode: replicated
      replicas: 1
      resources:
        limits:
          memory: 256M
        reservations:
          memory: 256M

  wikidata-dial-service:
    build:
      args:
        CONFIG: kg_dial_generator.json
        SERVICE_PORT: 8092
        COMMIT: 5dac85a06fde0e2983c7569ae058e3bf2d45ce2c
      context: services/wikidata_dial_service
    command: flask run -h 0.0.0.0 -p 8092
    environment:
      - CUDA_VISIBLE_DEVICES=0
      - FLASK_APP=server
    deploy:
      mode: replicated
      replicas: 1
      resources:
        limits:
          memory: 10G
        reservations:
          memory: 10G

version: '3.7'
